<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% gcp_location = "#{external_attribute(pwd, 'gcp_location', doc_generation)}" -%>
describe google_compute_region(project: <%= gcp_project_id -%>, name: <%= gcp_location -%>) do
  it { should exist }
  it { should be_up }
  its('zone_names') { should include "#{gcp_location}-a" }
end

describe google_compute_region(project: <%= gcp_project_id -%>, name: 'notthere') do
  it { should_not exist }
end

<% if doc_generation -%>
```
  ### Test that a GCP compute region exists
```
  describe google_compute_region(project: 'chef-inspec-gcp',  region: 'europe-west2') do
    it { should exist }
  end
```
  ### Test that a GCP compute region is in the expected state
```
  describe google_compute_region(project: 'chef-inspec-gcp',  region: 'europe-west2') do
    its('status') { should eq 'UP' }
    # or equivalently
    it { should be_up }
  end
```
  ### Test a GCP compute region identifier
```
  describe google_compute_region(project: 'chef-inspec-gcp',  region: "asia-east1") do
    its('id') { should eq "1220" }
  end
```
  ### Check that a region is associated with the expected zone fully qualified name
```
  describe google_compute_region(project: 'chef-inspec-gcp',  region: "asia-east1") do
    its('zones') { should include "https://www.googleapis.com/compute/v1/projects/spaterson-project/zones/asia-east1-a" }
  end
```
  ### Check that a region is associated with the expected zone short name
```
  describe google_compute_region(project: 'chef-inspec-gcp',  region: "asia-east1") do
    its('zone_names') { should include "asia-east1-a" }
  end
```

  The `zone_names` property is also useful for subsequently looping over associated `google_compute_zone` resources.  For example:
```
  google_compute_region(project: 'chef-inspec-gcp',  region: "asia-east1").zone_names.each do |zone_name|
    describe google_compute_zone(project: 'chef-inspec-gcp', name: zone_name) do
      it { should be_up }
    end
  end
<% end -%>